

function addSensorbitCod(Blockly) {





    //火焰传感器模块
  Blockly.Python.microbit_fire = function(block) {
    var dropdown_fireeAnalog = this.getFieldValue('fireAnalog');
    Blockly.Python.definitions_['import_microbit'] = 'from microbit import *';
    Blockly.Python.definitions_['import_Flame'] = 'from sensor import flame';
    Blockly.Python.definitions_['import_fireeAnalog' + dropdown_fireeAnalog] = 'fireDigital' + dropdown_fireeAnalog + ' = '+ dropdown_fireeAnalog;
    var code = "flame.get_value(fireDigital" + dropdown_fireeAnalog + ")";
    return [code];
  }

  //火焰传感器模块
  Blockly.Python.microbit_fireReadDigital = function(block) {
    var dropdown_fireDigital = this.getFieldValue('fireDigital');
    Blockly.Python.definitions_['import_microbit'] = 'from microbit import *';
    Blockly.Python.definitions_['import_Flame'] = 'from sensor import flame';
    Blockly.Python.definitions_['import_fireDigital' + dropdown_fireDigital] = 'fireDigital' + dropdown_fireDigital + ' = '+dropdown_fireDigital;
    // Blockly.Python.definitions_['import_rainAnalog'] = 'rainAnalogPort' + dropdown_raineAnalog + ' = '+dropdown_raineAnalog;
    var code = "flame.is_fire(fireDigital" + dropdown_fireDigital + ")";
    return [code];
  }

    return Blockly;
}

module.exports = addSensorbitCod;

